<template>
  <div>
    车场管理系统-首页
  </div>
</template>

<script setup lang="ts" name="index">
import {useRouter, useRoute} from 'vue-router';
import {ElMessage, ElMessageBox} from 'element-plus';
import {UserApi} from "@/api";
import {useCookies} from "vue3-cookies";
import {useUserStore} from "@/store/user";
import {useMenuStore} from "@/store/menu";

const {cookies} = useCookies();
const user = useUserStore();

const router = useRouter();
const route = useRoute();

const {token, loginurl} = route.query;

const icons = [
  'Files',
  'Calendar',
  'DocumentCopy',
  'Edit',
  'Operation',
  'Tickets',
  'Memo',
  'Collection',
  'Postcard',
  'ScaleToOriginal',
  'SetUp',
  'Reading',
];

function handleMenuList(menu: []) {
  const resMenu = menu.map((menuItem: any, index: number) => {
    let resItem = {
      icon: menuItem?.icon || icons[index] || 'Files',
      index: menuItem?.url,
      title: menuItem?.title,
    };
    if (menuItem?.children?.length) {
      resItem['subs'] = handleMenuList(menuItem?.children);
    }
    return resItem;
  });
  return resMenu;
}

const login = (url: any) => {
  window.location.href = url;
}

</script>

<style lang="less" scoped>

</style>